{%extends "base/page.html"%}
{%block title%}Linux downloads (Debian){%endblock%}
{%block extrahead%}
<script type="text/javascript" src="/media/js/download.js?{{gitrev}}"></script>
{%endblock%}
{%block contents%}

<h1>Linux downloads (Debian) <img class="logo" src="/media/img/debian.svg" alt="Debian Logo" /></h1>
<p>
PostgreSQL is available in all Debian versions by default. However, the
stable versions of Debians "snapshot" a specific version of PostgreSQL
that is then supported throughout the lifetime of that Debian version.
The PostgreSQL project also maintains an <a href="#apt">apt repository</a> with all supported
of PostgreSQL available.
</p>

<a name="apt"></a>
<h2>PostgreSQL Apt Repository</h2>
<p>
If the version included in your version of Debian is not the one you want,
you can use the <a href="https://apt.postgresql.org" target="_blank" rel="noopener">PostgreSQL Apt Repository</a>. This repository will integrate
with your normal systems and patch management, and provide automatic
updates for all supported versions of PostgreSQL throughout the support
<a href="/support/versioning/">lifetime</a> of PostgreSQL.
</p>
<p>
The PostgreSQL apt repository supports the currently supported stable
versions of Debian:
</p>
<ul>
  <li>Bullseye (11.x)</li>
  <li>Buster (10.x)</li>
  <li>Stretch (9.x)</li>
  <li>Sid (unstable)</li>
</ul>
<p>on the following architectures:</p>
<ul>
  <li>amd64</li>
  <li>arm64 (Buster and newer)</li>
  <li>i386 (Buster and older)</li>
  <li>ppc64el</li>
</ul>
<p>
To use the apt repository, follow these steps:
</p>

<div class="pg-script-container">
    <pre id="script-box" class="code"># Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# Update the package lists:
sudo apt-get update

# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql</pre>
    <button id="copy-btn" class="pg-script-copy-btn">Copy Script</button>
</div>

<p>
For more information about the apt repository, including answers to frequent
questions, please see the apt page on
<a href="https://wiki.postgresql.org/wiki/Apt" target="_blank" rel="noopener">the wiki</a>.
</p>

<h2>Included in distribution</h2>
<p>
Debian includes PostgreSQL by default. To install PostgreSQL on
Debian, use the <code>apt-get</code> (or other apt-driving) command:
</p>
<pre class="code">
  apt-get install postgresql-12
</pre>
<p>
The repository contains many different packages including third party
addons. The most common and important packages are (substitute the
version number as required):
</p>
<table class="table table-striped">
  <tbody>
    <tr>
     <th scope="row">postgresql-client-12</th>
     <td>client libraries and client binaries</td>
    </tr>
    <tr>
     <th scope="row">postgresql-12</th>
     <td>core database server</td>
    </tr>
    <tr>
     <th scope="row">postgresql-contrib-9.x</th>
     <td>additional supplied modules (part of the postgresql-xx package in version 10 and later)</td>
    </tr>
    <tr>
     <th scope="row">libpq-dev</th>
     <td>libraries and headers for C language frontend development</td>
    </tr>
    <tr>
     <th scope="row">postgresql-server-dev-12</th>
     <td>libraries and headers for C language backend development</td>
    </tr>
    <tr>
     <th scope="row">pgadmin4</th>
     <td>pgAdmin 4 graphical administration utility</td>
    </tr>
  </tbody>
</table>
{%endblock%}
